package com.woniuxy.creditsystem.financialmag.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.creditsystem.common.bean.PageRequest;
import com.woniuxy.creditsystem.common.bean.PutMoneyInfo;
import com.woniuxy.creditsystem.common.mapper.PutMoneyInfoMapper;
import com.woniuxy.creditsystem.financialmag.service.IPutMoneyInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：pengchufeng
 * @date ：Created in 2020/12/12
 * @description：放款信息service接口实现
 */
@Transactional(readOnly = true)
@Service
public class PutMoneyInfoImpl implements IPutMoneyInfo {

    @Resource
    private PutMoneyInfoMapper putMoneyInfoMapper;

    /**
     * 无条件查询所有放款信息
     * @Param putMoneyInfo 条件
     * @return
     */
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public PageInfo<PutMoneyInfo> findAll(@Param("p") PageRequest request, @Param("putMoneyInfo")PutMoneyInfo putMoneyInfo) {
        return PageHelper.startPage(request.getPageNum(),request.getLimit()).
                doSelectPageInfo(()->putMoneyInfoMapper.findAll(request,putMoneyInfo));
    }
}
